package com.example.ssm.onstart;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @date 2020/6/30 15:53
 */
@Component
public class Test {

    @Value("server.port")
    private String whatIWant;

    @Autowired
    Environment environment;


    public String getWhatIWant() {
        return whatIWant;
    }

    public void setWhatIWant(String whatIWant) {
        this.whatIWant = whatIWant;
    }

    public void dosth(){

        System.out.println(environment.getProperty("server.port"));

        System.out.println(whatIWant);
    }
}
